<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            position: relative;
            height: 55px;
            width: 55px;
             
        }
        .logo{
            display: block;
            height: 55px;
            width: 55px;
            background-color: #ff6700;
            text-indent: -9999em;
        }
        .logo::before{
            position: absolute;
            content: '';
            left: 0;
            top: 0;
            width: 55px;
            height: 55px;
            transition: all 0.7s;
            background: url(images/mi-logo.png) no-repeat center center;
            opacity: 1;
        }
        .logo::after{
            position: absolute;
            content: '';
            top: 0;
            left: 0;
            width: 55px;
            height: 55px;
            margin-left: -55px;
            transition: all 0.7s;
            background: url(images/mi-home.png) no-repeat center center;
        }
        .logo:hover::before {
            opacity: 0;
            margin-left: 55px;
        }
        /* 鼠标移入 让mi home 回到盒子中间 */
        
        .logo:hover::after {
            opacity: 1;
            margin-left: 0;
        }
    </style>
</head>
<body>
    <div class="box">
   <a href="#" class="logo">小米官网</a>
    </div>
</body>
</html>